package com.ytjj.qmyx.mall.mapper;

import com.ytjj.qmyx.mall.model.DynamicComment;
import com.ytjj.qmyx.mall.model.request.DynamicCommentRequest;
import com.ytjj.qmyx.mall.model.response.DynamicCommentResponse;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface DynamicCommentDao {

    /**
     * 获取动态总数
     */
    Integer getDynamicCount(@Param("userId") Integer userId);

    List<DynamicCommentResponse> getParentComment(@Param("dynamicId") Integer dynamicId, @Param("limitNum") int limitNum);

    List<DynamicCommentResponse> getChildrenByPid(@Param("pid") Integer pid, @Param("limitNum") int limitNum);

    /**
    * 获得动态的评论列表
    * @param dynamicCommentRequest:
    * @returns: java.util.List<com.ytjj.qmyx.mall.model.response.DynamicCommentResponse>
    * 
    */
    List<DynamicCommentResponse> getCommentsByDynamicId(DynamicCommentRequest dynamicCommentRequest);

    /**
    * 根据Id获得评论
    * @param id:
    * @returns: com.ytjj.qmyx.mall.model.response.DynamicCommentResponse
    * 
    */
    DynamicCommentResponse getCommentId(Integer id);

    long getTotalCommentsByDynamicId(@Param("dynamicId") Integer dynamicId);

    /**
     * 评论或回复 点赞/取消点赞
     * @param tabType:操作表的类型 0-评论 1-回复
     * @param id:主键
     * @param operation:点赞数加上的值
     * @returns: int
     * 
     */
    int commentLikeIncr(Integer tabType,Integer id,Integer operation);

}
